package com.seashop.config;

import com.seashop.enums.CountryCodeEnum;
import org.apache.commons.lang3.StringUtils;

/**
 * @author moredln
 * @desc
 * @date 2020-08-12 13:43
 */
public class SystemMethodConfig {


    public static String getLanguageTypeByCountryCode(String countryCode) {
        if (StringUtils.isBlank(countryCode)) {
            return CountryCodeEnum.US.getLanguageType();
        }
        if (CountryCodeEnum.CN.name().equals(countryCode)) {
            return CountryCodeEnum.CN.getLanguageType();
        } else if (CountryCodeEnum.TH.name().equals(countryCode)) {
            return CountryCodeEnum.TH.getLanguageType();
        } else if (CountryCodeEnum.ID.name().equals(countryCode)) {
            return CountryCodeEnum.ID.getLanguageType();
        } else if (CountryCodeEnum.PK.name().equals(countryCode)) {
            return CountryCodeEnum.PK.getLanguageType();
        } else {
            return CountryCodeEnum.US.getLanguageType();
        }
    }

    public static String getCurrencySymbol(String countryCode) {
        if (CountryCodeEnum.CN.name().equals(countryCode)) {
            return "￥";
        } else if (CountryCodeEnum.TH.name().equals(countryCode)) {
            return "฿";
        } else if (CountryCodeEnum.ID.name().equals(countryCode)) {
            return "₨";
        } else if (CountryCodeEnum.PK.name().equals(countryCode)) {
            return "₨";
        } else {
            return "$";
        }
    }

    public static String getCountryCodeByLanguageType(String languageType) {
        if (StringUtils.isBlank(languageType)) {
            return CountryCodeEnum.US.getLanguageType();
        }
        if (CountryCodeEnum.CN.getLanguageType().equals(languageType)) {
            return CountryCodeEnum.CN.name();
        } else if (CountryCodeEnum.TH.getLanguageType().equals(languageType)) {
            return CountryCodeEnum.TH.name();
        } else if (CountryCodeEnum.ID.getLanguageType().equals(languageType)) {
            return CountryCodeEnum.ID.name();
        } else if (CountryCodeEnum.PK.getLanguageType().equals(languageType)) {
            return CountryCodeEnum.PK.name();
        } else {
            return CountryCodeEnum.US.name();
        }
    }
}
